package com.gof.example.adapter.obj_pattern;

import com.gof.example.adapter.Encryption;
import com.gof.example.adapter.Md5;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/6 10:00.
 * haiming.fei@tongdun.cn
 */
public class EncryptionAdapter implements Encryption {

    private Md5 md5;

    public EncryptionAdapter() {
        this(new Md5());
    }

    public EncryptionAdapter(Md5 md5) {
        this.md5 = md5;
    }

    @Override
    public String encrypt(String str) {
        System.out.println("object adapter pattern");
        return md5.enc(str);
    }
}
